package com.atguigu.gmall.all.controller;

import com.atguigu.gmall.model.product.SkuInfo;
import com.atguigu.gmall.product.client.ProductFeignClient;
import com.sun.org.apache.regexp.internal.RE;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

@Controller
@SuppressWarnings("all")
public class CartController {
    @Autowired
    private ProductFeignClient productFeignClient;
    /**
     * 去添加购物车后跳转的页面
     * @return
     */
    @GetMapping("/addCart.html")
    public String goAddCart(Long skuId, Integer skuNum, Model model){
        SkuInfo skuInfo = productFeignClient.getSkuInfo(skuId);
        model.addAttribute("skuInfo",skuInfo);
        model.addAttribute("skuNum",skuNum);
        return "cart/addCart";
    }


    /**
     * 去我的购物车页面
     * @return
     */
    @GetMapping("/cart.html")
    public String goIndex(){
        return "cart/index";
    }
}
